package util;

public enum ControlActions implements Action {

	PAUSE {
		@Override
		public void performAction (Object param) {
			if (param instanceof Object[]) {
				Object[] params = (Object[]) param;
				if (params.length == 2 && params[0] instanceof DynamicImage && params[1] instanceof Integer) {
					DynamicImage target = (DynamicImage) params[0];
					target.pause((int) params[1]);
				}
			}
		}
	},

	RESUME {
		@Override
		public void performAction (Object param) {
			if (param instanceof Object[]) {
				Object[] params = (Object[]) param;
				if (params.length == 2 && params[0] instanceof DynamicImage && params[1] instanceof Integer) {
					DynamicImage target = (DynamicImage) params[0];
					target.resume((int) params[1]);
				}
			}
		}
	},

	START {
		@Override
		public void performAction (Object param) {
			if (param instanceof DynamicImage) {
				DynamicImage image = (DynamicImage) param;
				image.play();
			}
		}
	},

	STOP {
		@Override
		public void performAction (Object param) {
			if (param instanceof DynamicImage) {
				DynamicImage image = (DynamicImage) param;
				image.stop();
			}
		}
	}

}
